//
//  HealthReportsVC.m
//  Ginix
//
//  Created by fzq on 2025/2/17.
//

#import "HealthReportsVC.h"
#import "HealthReportsView.h"
#import "HealthAllView.h"

@interface HealthReportsVC ()
@property (nonatomic, strong) JXCategoryImageView   * myCategoryView;
@property (nonatomic,strong) UIScrollView * contentView;

@property (nonatomic,strong) HealthReportsView * reportsView;
@property (nonatomic,strong) HealthAllView * allView;
@end

@implementation HealthReportsVC

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setSubViewLayout];
}

-(void)setSubViewLayout{
    
    self.title = @"历史记录";
    [self.view addSubview:self.myCategoryView];
    [self.view addSubview:self.contentView];
    
    [self.contentView addSubview:self.reportsView];
    [self.contentView addSubview:self.allView];
}

-(JXCategoryImageView *)myCategoryView{
    
    if (!_myCategoryView) {
        _myCategoryView = [[JXCategoryImageView alloc]initWithFrame:CGRectMake(0, NavHeight + 10 * FMScaleX, WIDTH, 34 * FMScaleX)];
        _myCategoryView.contentScrollView = self.contentView;
        _myCategoryView.imageInfoArray = @[@"Me_healthp_icon_no",@"Me_healthp_all_no"];
        _myCategoryView.selectedImageInfoArray = @[@"Me_healthp_icon_sel",@"Me_healthp_all_sel"];
        _myCategoryView.loadImageBlock = ^(UIImageView *imageView, id info) {
            NSString *imageName = info;
            imageView.image = [UIImage imageNamed:imageName];
        };
        _myCategoryView.imageZoomEnabled = NO;
        _myCategoryView.imageCornerRadius = 0;
        _myCategoryView.imageSize = CGSizeMake(160 * FMScaleX, 30 * FMScaleX);
    }
    return _myCategoryView;
}
-(UIScrollView *)contentView{
    
    if (!_contentView) {
        _contentView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, GETMaxY(self.myCategoryView) +10 * FMScaleX, WIDTH, HEIGHT - NavHeight - 85 * FMScaleX - safaHeight - TabBarHeight)];
        _contentView.contentSize = CGSizeMake(WIDTH, _contentView.getHeight);
        _contentView.backgroundColor = UIColor.clearColor;
        _contentView.showsVerticalScrollIndicator = NO;
        _contentView.showsHorizontalScrollIndicator = NO;
        _contentView.bounces = NO;
        _contentView.pagingEnabled = YES;
        _contentView.contentSize = CGSizeMake(WIDTH * 3, _contentView.mj_h);

    }
    return _contentView;
}

-(HealthReportsView *)reportsView{
    
    if(!_reportsView){
        _reportsView = [[HealthReportsView alloc]initWithFrame:CGRectMake(0, 0, _contentView.getWidth, _contentView.getHeight)];
    }
    return _reportsView;
}
-(HealthAllView *)allView{
    
    if(!_allView){
        _allView = [[HealthAllView alloc]initWithFrame:CGRectMake(WIDTH, 0, _contentView.getWidth, _contentView.getHeight)];
    }
    return _allView;
}
@end
